package com.hhs.storage.controller;


import com.hhs.storage.bean.InputParam;
import com.hhs.storage.bean.TopicMessage;
import com.hhs.storage.bean.TopicUserRefuseCount;
import com.hhs.storage.service.TopicMessageService;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hhs
 * @since 2023-03-01
 */
@RestController
@RequestMapping("/topicMessage")
public class TopicMessageController {
    @Resource
    private TopicMessageService topicMessageService;

    /**
     * 根据话题获取所有相关评论
     * @param topicId
     * @return
     */
    @RequestMapping("/getListByTopicId")
    public Map<String,Object> getListByTopicId(String topicId,String bakTopicId,Boolean lookAll){
        return topicMessageService.getListByTopicId(topicId,bakTopicId,lookAll);
    }
    /**
     * 更改未读状态
     */
    @RequestMapping("/getEdit")
    public Map<String,Object> getEdit(@RequestParam String topicId){
        return topicMessageService.getEdit(topicId);
    }




    /**
     * 查询当前用户消息分组列表
     * @param param
     * @return
     */
    @RequestMapping("/getMessageGroupList")
    public Map<String,Object> getMessageGroupList(InputParam param){
        return topicMessageService.getMessageGroupList(param);
    }
    /**
     * 查询当前用户是否有未读消息
     * @return
     */
    @RequestMapping("/checkHasNewMessage")
    public Map<String,Object> checkHasNewMessage(){
        return topicMessageService.checkHasNewMessage();
    }
    @RequestMapping("/add")
    public Map<String,Object> add(TopicMessage topicMessage){
        return topicMessageService.add(topicMessage);
    }
    @RequestMapping("/delete")
    public Map<String,Object> delete(String id){
        return topicMessageService.delete(id);
    }

    @RequestMapping("/refuse")
    public Map<String,Object> refuse(TopicUserRefuseCount t){
        return topicMessageService.refuse(t);
    }

    @RequestMapping("/agree")
    public Map<String,Object> agree(TopicUserRefuseCount t){
        return topicMessageService.agree(t);
    }
}

